package com.colt.contentcenter.controller.share;

import com.colt.contentcenter.aop.auth.CheckAuthorization;
import com.colt.contentcenter.domain.dto.content.ShareAuditDTO;
import com.colt.contentcenter.domain.entity.content.Share;
import com.colt.contentcenter.service.share.ShareService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: content-center
 * @description: 管理员审核分享控制器
 * @author: colt
 * @create: 2020-08-07 11:00
 **/
@RestController
@RequestMapping("/admin/shares")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ShareAdminController {
    private final ShareService shareService  ;

    //此api必须要有admin角色才能访问
    @CheckAuthorization("admin")
    @PutMapping("/audit/{id}")
    public Share auditById(@PathVariable Integer id, @RequestBody ShareAuditDTO shareAuditDTO){
        //TODO 认证  授权
        return this.shareService.auditById(id,shareAuditDTO);

    }
}
